﻿@using System.Globalization;

@if (ViewModel.HasLanguages)
{
    <Dropdown >
        <Overlay>
            <Menu>
                @foreach (var language in ViewModel.Languages)
                {
                    var twoLetterLanguageName = new CultureInfo(language.CultureName).TwoLetterISOLanguageName.ToUpperInvariant();

                    <MenuItem OnClick="@(()=>ViewModel.LanguagePlatformManager.ChangeAsync(language))">
                        @language.DisplayName / @twoLetterLanguageName
                    </MenuItem>
                }
            </Menu>
        </Overlay>
        <ChildContent>
            <span class="ant-dropdown-link" >
                <Icon Type="global" Theme="outline" />
            </span>
        </ChildContent>
    </Dropdown>
}